﻿using Microsoft.Win32;
using System.Reflection;

namespace RegistryCleaner
{
    public static class Cleaner
    {
        /// <summary>
        /// Removes all application's traces from the registry (eg. When uninstalling)
        /// </summary>
        /// <remarks>
        /// It is assumed that the "company" (in this case: me) has not installed any other
        /// applications On user'pShift computer, so we safely remove the entire "company'pShift" entry.
        /// </remarks>
        internal static void ClearRegistry()
        {
            Registry.CurrentUser.DeleteSubKeyTree(
                @"Software\" +  // hard-coded, as Windows registry is not localized (I think!)
                Assembly.GetExecutingAssembly().GetCustomAttributes(
                typeof(AssemblyCompanyAttribute),
                false));
        }
    }
}
